package 对象序列化流;
import java.io.Serializable;

public class Student implements Serializable{//（标记接口）这个序列化接口没有方法需要重写，只是将序列化进行反序列化
    private static final long serialVersionUID = 42L;
    private String name;
//    private int age;
private transient int age;//被transient修饰的成员变量不参与序列化过程 age默认值为0

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

//    @Override
//    public String toString() {//修改了这个类的文件会重新产生一个序列化ID
//        return "Student{" +
//                "name='" + name + '\'' +
//                ", age=" + age +
//                '}';
//    }
}
